<%@page import="doan.quanlycanbo.portlet.util.ActionUtil"%>
<%@page import="doan.quanlycanbo.portlet.service.hosoLocalServiceUtil"%>
<%@page import="doan.quanlycanbo.portlet.model.hoso"%>
<%@page import="doan.quanlycanbo.portlet.util.PortletKeysExt"%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="com.liferay.portal.service.permission.PortletPermissionUtil" %>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="com.liferay.portal.model.User" %>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil" %>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil" %>

<%@page import="javax.portlet.PortletURL"%>
<%@page import="java.util.List"%>
<%@page import="com.liferay.portal.kernel.util.ListUtil"%>

<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<portlet:defineObjects/>
<liferay-theme:defineObjects />

<portlet:actionURL name="deleteProfile" var="deleteProfileURL"/>
<portlet:renderURL var="addProfileURL">
	<portlet:param name="jspPage" value="/html/manage_employee/employee/add_profile.jsp"/>
</portlet:renderURL>

<script type="text/javascript">
function <portlet:namespace />submitdeleteProfiles() {
		submitForm(document.<portlet:namespace/>fm, '<%= deleteProfileURL.toString() %>');
}
</script>

<input type="button" value="Them Ho so" onClick="window.location.href='<%= addProfileURL.toString() %>' "/>
<input type="button" value="Xoa" onclick="<portlet:namespace/>deleteProfiles()"/>
<br/><br/>
<aui:form name="fm" Method="post">
<input name="<portlet:namespace />allRowIds" type="hidden" value="">
<liferay-ui:search-container>
	<liferay-ui:search-container-results>
		<%
			List<hoso> hosoList = hosoLocalServiceUtil.getAll();
			results = ListUtil.subList(hosoList, searchContainer.getStart(), searchContainer.getEnd());
			total = hosoList.size();
			pageContext.setAttribute("results", results);
			pageContext.setAttribute("total", total);
		%>
	</liferay-ui:search-container-results>
	<liferay-ui:search-container-row className="doan.quanlycanbo.portlet.model.hoso" keyProperty="mahoso" modelVar="hoso">
		<%
			String name1 = "<input type='checkbox' name='<portlet:namespace />allRowIds' onclick='Liferay.Util.checkAll(AUI().one(this).ancestor('table.taglib-search-iterator'), '<portlet:namespace/> allRowId', this);'/>";
    		String name="<input type='checkbox'  onclick=\"Liferay.Util.checkAll(AUI().one(this).ancestor('table.taglib-search-iterator'), '<portlet:namespace />allRowIds', this);\" />";
    		String input="<input type='checkbox' name='<portlet:namespace />allRowIds' value='"+ user.getUserId()+"'/>";
		%>
		<liferay-ui:search-container-column-text  name="<%=name %>" value="<%=input %>" />
		<liferay-ui:search-container-column-text name="Ten can bo" property="hoten"  />
		<liferay-ui:search-container-column-jsp path="/html/manage_employee/employee/actions_employee.jsp" align="right"/>
	</liferay-ui:search-container-row>
	<liferay-ui:search-iterator searchContainer="<%= searchContainer %>" />
</liferay-ui:search-container>
</aui:form>





<%-- <aui:form name="fm" Method="post"> --%>
<%-- <input name="<portlet:namespace />allRowIds" type="hidden" value=""> --%>
<%-- <liferay-ui:search-container> --%>
<%-- 	<liferay-ui:search-container-results> --%>
<%-- 		<% --%>
<!-- //  			List<User> userList = UserLocalServiceUtil.getOrganizationUsers(PortletKeysExt.ORG_VKHCNVN_ID); -->
<!-- // 			results = ListUtil.subList(userList, searchContainer.getStart(), searchContainer.getEnd()); -->
<!-- // 			total = userList.size(); -->
<!-- // 			pageContext.setAttribute("results", results); -->
<!-- // 			pageContext.setAttribute("total", total); -->
<!--  		%>  -->
<%-- 	</liferay-ui:search-container-results> --%>
<%-- 	<liferay-ui:search-container-row className="com.liferay.portal.model.User" keyProperty="userId" modelVar="user"> --%>
<%-- 		<% --%>
<%-- // 			String name1 = "<input type='checkbox' name='<portlet:namespace />allRowIds' onclick='Liferay.Util.checkAll(AUI().one(this).ancestor('table.taglib-search-iterator'), '<portlet:namespace/> allRowId', this);'/>"; --%>
<!-- //     		String name="<input type='checkbox'  onclick=\"Liferay.Util.checkAll(AUI().one(this).ancestor('table.taglib-search-iterator'), '<portlet:namespace />allRowIds', this);\" />"; -->
<%-- //     		String input="<input type='checkbox' name='<portlet:namespace />allRowIds' value='"+ user.getUserId()+"'/>"; --%>
			
<!-- // 			String nameEmployee = user.getFirstName() + " " + user.getMiddleName() + " " + user.getLastName();  -->
<%-- 		%> --%>
<%-- 		<liferay-ui:search-container-column-text  name="<%=name %>" value="<%=input %>" /> --%>
<%-- 		<liferay-ui:search-container-column-text name="Employee" value="<%=nameEmployee %>"  /> --%>
<%-- 		<liferay-ui:search-container-column-jsp path="/html/manage_employee/employee/actions_employee.jsp" align="right"/> --%>
<%-- 	</liferay-ui:search-container-row> --%>
<%-- 	<liferay-ui:search-iterator searchContainer="<%= searchContainer %>" /> --%>
<%-- </liferay-ui:search-container> --%>
<%-- </aui:form> --%>

<aui:script >
	Liferay.provide(
		window,
		'<portlet:namespace/>deleteProfiles',
		function() {
		document.<portlet:namespace />fm.<portlet:namespace />allRowIds.value = Liferay.Util.listCheckedExcept(document.<portlet:namespace />fm, "allRowIds");
		
		if(document.<portlet:namespace />fm.<portlet:namespace />allRowIds.value.length>0)
		{
			if (confirm("Bạn có chắc muốn xóa những hồ sơ này ?")) {
			
		        document.<portlet:namespace />fm.<portlet:namespace />allRowIds.value = Liferay.Util.listCheckedExcept(document.<portlet:namespace />fm, "allRowIds");
		    
				<portlet:namespace/>submitdeleteProfiles();
			}
		}	else{
			alert("Bạn phải trước khi muốn xóa !");
			}
		},
		['liferay-util-list-fields']
	);
</aui:script>







